import jieba
import jieba.posseg as psg

def jieba_base():
    content = "传智教育是一家上市公司，旗下有黑马程序员品牌。我是在黑马这里学习人工智能"
    j1 = jieba.cut(sentence=content,cut_all=False)
    print(j1)

    j1data = jieba.lcut(sentence=content,cut_all=False)
    print(j1data)

    j2 = jieba.cut(sentence=content,cut_all=True)
    print(j2)

    j2data = jieba.lcut(sentence=content,cut_all=True)
    print(j2data)

    j3 = jieba.cut_for_search(sentence=content)
    print(j3)

    j3data = jieba.lcut_for_search(sentence=content)
    print(j3data)

# 用户自定义字典
# 名次+词频+词性
def jieba_userdict():
    content = "传智教育是一家上市公司，旗下有黑马程序员品牌。我是在黑马这里学习人工智能"
    j1data = jieba.lcut(sentence=content,cut_all=False)
    print(j1data)

    jieba.load_userdict('/Users/lishi/python/textpreprocessing/userdict.txt')
    j1data = jieba.lcut(sentence=content,cut_all=False)
    print(j1data)

# 词性标注
def jieba_posseg():
    j1data = psg.lcut("我爱北京天安门")
    print(j1data)


if __name__ == '__main__':
    jieba_posseg()